Control unit and method for controlling motor for use in printer, and storage medium storing control program

ABSTRACT

There is provided a control unit capable of rapid and precise stoppage of an object to be driven by a motor for use in a printer. The control unit has a speed control part to control the object by acceleration control, constant speed control, deceleration control, and stoppage control by controlling a current to be applied to the motor, and also an inertia calculating part to calculate inertia of the object based on angular acceleration of the motor under the acceleration control of the object, and current values to be applied to the motor under the acceleration control and the constant speed control of the object. The speed control part uses the calculated inertia for controlling the current to be applied to the motor.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates generally to a control unit and method forcontrolling a motor for use in a printer, and a storage medium storing acontrol program. More specifically, the invention is used forcontrolling the speed of a motor for driving a carriage of a serialprinter.

2. Description of Related Art

In a typical serial printer such as an ink jet printer, a recording headscans on a printing paper to print. This recording head is fixed to acarriage to move with the carriage. This carriage is driven by a DC(Direct Current) motor. The system for driving the carriage is asfollows.

First, a CR motor starts by acceleration control. The CR motor is drivenat a constant speed by PID control. Then, the CR motor decelerates tostop.

A printing operation is executed while a carriage is transferring at aconstant speed, or the CR motor is driven at the constant speed.

PID control is performed based on a deviation of a counted value of theoutput pulses of an encoder rotating in accordance with the rotation ofthe CR motor from a target position (target number of pulses).

The carriage will stop, however, at a position apart from the targetposition due to change in carriage inertia (moment of inertia), loads,motor currents, and so on. A special control (logical seek) is requiredto stop the carriage at the target position. Such a control is verycomplex and takes long.

SUMMARY OF THE INVENTION

It is therefore an object of the present invention to eliminate theaforementioned problems and to provide a control unit, a method, and astorage medium having a control program recorded therein for alwaysprecisely stopping an object driven by a motor for use in a printer at atarget position.

In order to accomplish the aforementioned and other objects, accordingto one aspect of the present invention, there is provided a control unitfor controlling a motor for use in a printer, including: a speed controlpart to control an object to be controlled that is driven by the motorby acceleration control, constant speed control, deceleration control,and stoppage control by controlling a current to be applied to themotor; and an inertia calculating part to calculate inertia of theobject based on angular acceleration of the motor under the accelerationcontrol of the object, and current values to be applied to the motorunder the acceleration control and the constant speed control of theobject, the calculated inertia being used by the speed control part forcontrolling the current to be applied to the motor.

The control unit may further include a stoppage current calculating partto calculate a stoppage current to be used for stopping the object at atarget position based on the calculated inertia, an angular velocity ofthe motor under the deceleration control of the object, the currentvalue of the motor under the constant speed control of the object, and astoppage constant T_(BRK), the speed control part performing control ofstopping the object by applying the calculated stoppage current.

It is preferable that a predetermined current value Iacc is applied tothe motor in a constant current acceleration range under theacceleration control for accelerating the object, the inertiacalculation part calculating angular acceleration Δω/Δt in the constantcurrent acceleration range, and calculating inertia J of the objectbased on the angular acceleration Δω/Δt, a current value I_(f) to beapplied to the motor under the constant speed control of the object, andthe current value Iacc.

It is preferable that the current value I_(f) corresponds to a speed ofthe object under constant speed control just before a transition fromthe constant speed control to the deceleration control.

The stoppage current calculating part may use an angular velocity underdeceleration control just before a transition from the decelerationcontrol to the stoppage control, as the angular velocity of the motor.

The control unit may further include a period measuring part to measurea period of each output pulse of an encoder that rotates in accordancewith rotation of the motor, the angular acceleration and the angularvelocity of the motor being calculated based on the output of the periodmeasuring part.

The stoppage constant T_(BRK) may be decided based on the current valueto be applied to the motor under the constant speed control and apositional deviation of an actual position of the motor from the targetposition.

Moreover, the present invention provides a method of controlling a motorfor use in a printer, including the steps of: calculating inertia of anobject to be driven by the motor based on angular acceleration of themotor under acceleration control of the object, and current values to beapplied to the motor under the acceleration control and the constantspeed control of the object; and controlling a current to be applied tothe motor by means of the calculated inertia.

The step of controlling the current may include the steps of:calculating a stoppage current to be used for stopping the object at atarget position based on the calculated inertia, an angular velocity ofthe motor under deceleration control of the object, the current value ofthe motor under the constant speed control of the object, and a stoppageconstant T_(BRK); and stopping the object by applying the calculatedstoppage current to the motor.

Furthermore, the present invention provides a computer-readable storagemedium storing control program code for controlling a motor for use in aprinter, including: first program code means for calculating inertia ofa carriage based on angular acceleration of a carriage motor underacceleration control of the carriage and current values to be applied tothe carriage motor under the acceleration control and constant speedcontrol of the carriage; second program code means for calculating astoppage current to be used for stopping the carriage at a targetposition based on the calculated inertia, an angular velocity of themotor under deceleration control of the carriage, the current value tobe applied to the motor under the constant speed control of thecarriage, and a stoppage constant T_(BRK); and third program code meansfor stopping the carriage by applying the calculated stoppage current tothe motor.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention will be understood more fully from the detaileddescription given herebelow and from the accompanying drawings of thepreferred embodiments of the invention. However, the drawings are notintended to imply limitation of the invention to a specific embodiment,but are for explanation and understanding only.

In the drawings:

FIG. 1 is a block diagram showing the construction of a preferredembodiment of a control unit for controlling a motor for use in aprinter according to the present invention;

FIG. 2 is a block diagram showing the construction of an inertiacalculating part of the control unit according to the present invention;

FIGS. 3(a) and 3(b) are waveform illustrations of the embodiment shownin FIG. 1;

FIG. 4 is a block diagram schematically showing the construction of anink jet printer;

FIG. 5 is a perspective view showing the peripheral construction of acarriage;

FIG. 6 is a schematic view showing the construction of a linear typeencoder;

FIGS. 7(a) and 7(b) are waveform illustrations of output pulses of anencoder;

FIG. 8 is a schematic perspective view of a printer for explaining theposition of a paper detecting sensor;

FIG. 9 is a flow chart showing a control procedure in a method forcontrolling a motor for use in a printer according to the presentinvention;

FIG. 10 is a perspective view showing an example of a computer systemusing a storage medium, in which a print control program has beenrecorded, according to the present invention; and

FIG. 11 is a block diagram showing an example of a computer system usinga storage medium, in which a print control program has been recorded,according to the present invention.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

Referring now to the accompanying drawings, the preferred embodiments ofthe present invention will be described below.

First, the schematic construction and control of an ink jet printer,which uses a control unit for controlling a motor for use in a printeraccording to the present invention, will be described. The schematicconstruction of this ink jet printer is shown in FIG. 4.

This ink jet printer comprises: a paper feed motor (which will be alsohereinafter referred to as a PF motor) 1 for feeding a paper; a paperfeed motor driver 2 for driving the paper feed motor 1; a carriage 3; acarriage motor (which will be also hereinafter referred to as a CRmotor) 4; a CR motor driver 5 for driving the carriage motor 4; a DCunit 6; a pump motor 7 for controlling the suction of ink for preventingclogging; a pump motor driver 8 for driving the pump motor 7; arecording head 9, fixed to the carriage 3, for discharging ink to aprinting paper 50; a head driver 10 for driving and controlling therecording head 9; a linear type encoder 11 fixed to the carriage 3; acode plate 12 which has slits in regular intervals; a rotary typeencoder 13 for use in the PF motor 1; a paper detecting sensor 15 fordetecting the position of the rear edge of a paper which is beingprinted; a CPU 16 for controlling the whole printer; a timer IC 17 forperiodically generating an interruption signal to output the signal tothe CPU 16; an interface part (which will be also hereinafter referredto as an IF 19 for transmitting/receiving data to/from a host computer18; an ASIC 20 for controlling the printing definition, the drivingwaveform of the recording head 9 and so forth on the basis of printinginformation which is fed from the host computer 18 via the IF 19; a PROM21, RAM 22 and EEPROM 23 which are used as working and program storingregions for the ASIC 20 and the CPU 16; a platen 25 for supporting thepaper 50 during print; a carrier roller 27, driven by the PF motor 1,for carrying the printing paper 50; a pulley 30 mounted on the rotatingshaft of the CR motor 4; and a timing belt 31 driven by the pulley 30.

Furthermore, the DC unit 6 is designed to drive and control the paperfeed motor driver 2 and the CR motor driver 5 on the basis of a controlcommand, which is fed from the CPU 16, and the outputs of the encoders11 and 13. In addition, each of the paper feed motor 1 and the CR motor4 comprises a DC motor.

The peripheral construction of the carriage 3 of this ink jet printer isshown in FIG. 5.

The carriage 3 is connected to the carriage motor 4 via the timing belt31 and the pulley 30 to be driven so as to be guided by a guide member32 to move in parallel to the platen 25. The carriage 3 is provided withthe recording head 9 on the surface facing the printing paper. Therecording head 9 comprises a nozzle row for discharging a black ink anda nozzle row for discharging color inks. Each nozzle is supplied withink from an ink cartridge 34, and discharges drops of ink to theprinting paper to print characters and/or images.

In a non-print region of the carriage 3, there are provided a cappingunit 35 for sealing a nozzle opening of the recording head 9 duringnon-print, and a pump unit 36 having the pump motor 7 shown in FIG. 4.When the carriage 3 moves from a print region to the non-print region,the carriage 3 contacts a lever (not shown) to move the capping unit 35upwards to seal the recording head 9.

When the nozzle opening row of the recording head 9 is clogged with ink,or when the cartridge 34 is exchanged or the like to force the recordinghead 9 to discharge ink, the pump unit 36 is operated in the sealedstate of the recording head 9, to suck ink out of the nozzle opening rowby a negative pressure from the pump unit 36. Thus, dust and paperpowder adhering to a portion near the nozzle opening row are cleaned.Moreover, bubbles of the recording head 9, together with ink, aredischarged to a cap 37.

Then, the construction of the linear type encoder 11 mounted on thecarriage 3 is shown in FIG. 6. This encoder 11 comprises a lightemitting diode 11 a, a collimator lens 11 b, and a detection processingpart 11 c. The detection processing part 11 c has a plurality of (four)photodiodes 11 d, a signal processing circuit 11 e, and two comparators11 f _(A) and 11 f ₈.

If a voltage Vcc is applied between both ends of the light emittingdiode 11 a via a resistor, light rays are emitted from the lightemitting diode 11 a. The light rays are collimated by the collimatorlens 11 b to pass through the code plate 12. The code plate 12 isprovided with slits at regular intervals (e.g., every {fraction (1/180)}inches (={fraction (1/180)}×2.54 cm)).

The parallel rays passing through the code plate 12 are incident on eachof the photodiodes 11 d via a fixed slit (not shown), and converted intoelectric signals. The electric signals outputted from the fourphotodiodes 11 d are processed by the signal processing circuit 11 e.The signals outputted from the signal processing circuit 11 e arecompared by the comparators llf_(A) and llf_(B), and the comparedresults are outputted as pulses. The pulses ENC-A and ENC-B outputtedfrom the comparators 11f_(A) and 11 f _(B) are outputs of the encoder11.

The phase of the pulse ENC-A is different from the phase of the pulseENC-B by 90 degrees. The encoder 4 is designed so that the phase of thepulse ENC-A is advanced from the pulse ENC-B by 90 degrees as shown inFIG. 7(a) when the CR motor 4 is normally rotating, i.e., when thecarriage 3 is moving a main scanning direction, and the phase of thepulse ENC-A lags behind the pulse ENC-B by 90 degrees as shown in FIG.7(b) when the CR motor 4 is reversely rotating. One period T of thepulses corresponds to the distance between adjacent slits of the codeplate 12 (e.g., {fraction (1/180)} inches (={fraction (1/180)}×2.54cm)). This is equal to a period of time, in which the carriage 3 movesbetween the adjacent slits.

On the other hand, the rotary type encoder 13 for use in the PF motor 1has the same construction as that of the linear type encoder 11, exceptthat the code plate is a rotating disk which rotates in accordance withthe rotation of the PF motor 1. Furthermore, in the ink jet printer, thedistance between adjacent slits of a plurality of slits provided in thecode plate of the encoder 13 for use in the PF motor is {fraction(1/180)} inches ({fraction (1/180)}×2.54 cm). When the PF motor 1rotates by the distance between adjacent slits, the paper is fed by{fraction (1/1440)} inches (={fraction (1/1440)}×2.54 cm).

Referring to FIG. 8, the position of the paper detecting sensor 15 shownin FIG. 4 will be described below.

In FIG. 8, the paper 50 inserted into a paper feeding port 61 of aprinter 60 is fed into the printer 60 is fed into the printer 60 bymeans of a paper feeding roller 64 which is driven by a paper feedingmotor 63. The front edge of the paper 50, which has been fed into theprinter 60, is detected by, e.g., an optical paper detecting sensor 15.The paper 50, the front edge of which has been detected by the paperdetecting sensor 15, is fed of which has been detected by the paperdetecting sensor 15, is fed by means of a paper detecting by the paperdetecting sensor 15, is fed by means of a paper feed roller 65 and adriven roller 66 which are driven by the PF motor 1.

Subsequently, ink drops from the recording head (not shown), which isfixed to the carriage 3 moving along the carriage guide member 32, tocarry out a print. Then, when the paper is fed to a predeterminedposition, the rear edge of the paper 50, which is currently beingprinted, is detected by the paper detecting sensor 15. Then, a gear 67 cis driven, via a gear 67 b, by means of a gear 67 a which is driven bythe PF motor 1. Thus, a paper discharging roller 68 and a driven roller69 are rotated to discharge the printed paper 50 from a paperdischarging port 62 to the outside.

(First Preferred Embodiment)

The construction of the first preferred embodiment of a control unit forcontrolling a motor for use in a printer according to the presentinvention is shown in FIG. 1. A controller 80 in this embodiment is usedfor controlling the carriage motor 4 (a DC motor) of the ink jetprinter, and installed in the DC unit 6 explained with reference to FIG.4.

The controller 80 comprises a position calculating part 81, a subtracter82, a target speed calculating part 83, a period measuring part 84, aspeed calculating part 85, a subtracter 86, a proportional element 87 a,an integrating element 87 b, a differentiating element 87 c, an adder89, a timer 90, an acceleration control part 91, a stoppage control part92 having an inertia calculating part 93 and a stoppage currentcalculating part 94, a selection part 95 and a D/A converter 96.

The position calculating part 6 a is designed to detect the leading andtrailing edges of each of the output pulses ENC-A and ENC-B of theencoder 11 to count the number of the detected edges, and to calculatethe position of the carriage 3 on the basis of the counted value. Inthis counting, when the CR motor 4 is normally rotating, if one edge isdetected, “+1” is added, and when the CR motor 4 is reversely rotating,if one edge is detected, “−1” is added. Each of the periods of thepulses ENC-A and ENC-B is equal to the distance between adjacent slitsof the code plate 12, and the phase of the pulse ENC-A is different fromthe phase of the pulse ENC-B by 90 degrees. Therefore, the counted value“−1” in the above described counting corresponds to ¼ of the distancebetween adjacent slits of the code plate 12. Thus, if the counted valueis multiplied by ¼ of the distance between adjacent slits, it ispossible to obtain the moving amount of the carriage 3 from a positioncorresponding to a counted value “0”. At this time, the definition ofthe encoder 11 is ¼ of the distance between adjacent slits of the codeplate 12. If the distance between adjacent slits is {fraction (1/180)}inches (={fraction (1/180)}×2.54 cm), the definition is {fraction(1/720)} inches (={fraction (1/720)}×2.54 cm).

The subtracter 82 is designed to calculate a position deviation of theactual position of the carriage 3, which is obtained by the positioncalculating part 81, from a target position which is fed from the CPU16.

The target speed calculating part 83 is designed to calculate a targetspeed of the carriage 3 on the basis of the position deviation which isthe output of the subtracter 82. This operation is carried out bymultiplying the position deviation by a gain K_(p). This gain K_(p) isdetermined in accordance with the position deviation. Furthermore, thevalue of the gain K_(p) may be stored in a table (not shown).

The target speed calculating part 83 continuously outputs apredetermined value Vs in a deceleration range for stoppage until thecalculated speed reaches the value Vs or less to stop the CR motor 4.The period measuring part 84 measures a period of each output pulseENC-A of the encoder 11, for example, from the leading to trailing edgesof the output pulse ENC-A by a timer counter (not shown).

The speed calculating part 85 calculates a speed of the carriage 3 basedon the output of the period measuring part 84. A speed of the carriage 3is calculated as λ/T in which λ is the distance between the slits of thecode plate 12, and T is one period of the output of the period measuringpart 84, or each output pulse ENC-A of the encoder 11.

The subtracter 86 is designed to calculate a speed deviation of theactual speed of the carriage 3, which is calculated by the speedcalculating part 85, from a target speed.

The proportional element 87 a is designed to multiply the speeddeviation by a constant Gp to output the multiplied result. Theintegrating element 87 b is designed to integrate a value which isobtained by multiplying the speed deviation by a constant Gi. Thedifferentiating element 87 c is designed to multiply a differencebetween the current speed deviation and the last speed variation by aconstant Gd to output the multiplied result. Furthermore, the operationsin the proportional element 87 a, integrating element 87 b anddifferentiating element 87 c are carried out every one period of theoutput pulse ENC-A of the encoder 11, i.e., in synchronism with theleading edge of the output pulse ENC-A.

The outputs of the proportional element 87 a, integrating element 87 band differentiating element 87 c are added by the adder 89. Then, theadded result is fed to the selection part 95.

In addition, the timer 90 and the acceleration control part 91 are usedfor controlling acceleration, and the PID control using the proportionalelement 87 a, integrating element 87 b and differentiating element 87 cis used for controlling the constant speed and deceleration duringacceleration. The stoppage control part 92 is used for stoppagecontrolling.

The timer 90 is designed to generate a timer interruption signal forevery predetermined time on the basis of a clock signal which is fedfrom the CPU 16.

The acceleration control part 91 is designed to integrate apredetermined current value (e.g., 20 mA) into a target current valueevery time it receives the timer interruption signal, and to feed theintegrated result, i.e., the target current value of the DC motor 4during acceleration, to the selection part 95.

The acceleration control part 91 feeds a command signal to the inertiacalculating part 92 when the target current value reaches apredetermined value Iacc.

As shown in FIG. 2, the inertia calculating part 93 has, for example, amemory 93 a, timer 93 b and a calculator 93 c. The inertia calculatingpart 93 calculates inertia J (including inertia of an ink cartridge) ofthe carriage 3 based on the output of the period measuring part 84, theoutput of the acceleration control part 91, and also the output of theintegrating element 87 b.

After receiving the command signal from the acceleration control part91, the memory 93 a stores the second period T₂ and the K-th periodT_(X) (K≧3) fed from the period measuring part 84. The periods T₂ andT_(X) are the values while the acceleration control part 91 isoutputting the predetermined value Iacc. The subscript K ispredetermined according to control.

The timer 93 b counts a period of time T_(t) from reception of thesecond period T₂ to the K-th period T_(X). Instead of counting, a periodT_(i) (i=2, . . . , K) from the second to the K-th can be integrated asT_(t)=T3+. . . +T_(k).

The calculator 93 c calculates the inertia J of the carriage 3 accordingto the equation (1) based on the values Iacc, T₂, T_(X) and T_(t), andalso an output If of the integrating element 87 b, which is the outputjust before the moment the carriage 3, or the CR motor 4 is intransition from the constant speed range to the deceleration range.$\begin{matrix}\begin{matrix}{J = \frac{I_{acc} - I_{f}}{\frac{\Delta\omega}{\Delta\quad t}}} \\{= \frac{I_{acc} - I_{f}}{\{ \frac{( {\frac{\alpha}{T_{\kappa}} - \frac{\alpha}{T_{2}}} )}{( {T_{2} + T_{s}} )} \}}}\end{matrix} & (1)\end{matrix}$

In the equation (1), ω and α represent an angular velocity of the CRmotor 4 and a constant for obtaining the angular velocity, respectively,the numerator indicates subtraction of a friction component I_(f) from atorque (a drive current Icc), and the denominator indicates the rate ofchange in angular velocity of the CR motor 4, or angular acceleration.

The stoppage current calculating part 94 calculates a current valueI_(STOP) to be applied to the CR motor 4 for stopping the carriage atthe target position according to the equation (2) based on the outputT_(f) of the period measuring part 84, the output I_(f) of theintegrating element 87 b in transition from the constant speed todeceleration ranges, the output of the subtracter 82, and also theoutput J of the inertia calculating part 93 when the output of thesubtracter 86 is decreased to a predetermined value or less while thetarget speed calculating part 83 is outputting a predetermined valueV_(s). $\begin{matrix}{I_{stop} = {I_{f} - {\frac{\frac{\alpha}{T_{f}}}{T_{BRK}}J}}} & (2)\end{matrix}$

The resultant current value I_(STOP) is supplied to the selection part95.

In the equation (2), α is a constant for obtaining an angular velocityof the CR motor 4, T_(BRK) is called a stoppage constant that is decidedby the stoppage current calculating part 94 based on the output of thesubtracter 82 just before stoppage control, or a positional deviation,and the output I_(f) of the integrating element 87 b. The value T_(BRK)is preferably stored on a table, and is obtained by experiment forachieving smaller stoppage positional error. The current value I_(STOP)is a forward current if the value is positive, while it is a reversecurrent if negative.

The selection part 95 selects either the output of the accelerationcontrol part 91 under acceleration control, the output of the adder 89at a constant speed under acceleration and under deceleration control,or the output of the stoppage current calculating part 94 under stoppagecontrol. The selected output is supplied to the D/A converter 96.

The output of the selection part 95 is converted into an analog currentby the D/A converter 96. On the basis of this analog current, the CRmotor 4 is driven by the driver 5.

The driver 5 has, e.g., four transistors. By turning each of thetransistors ON and OFF on the basis of the output of the D/A converter96, the driver 5 can be selectively in (a) an operation mode in whichthe CR motor 4 is normally or reversely rotated, (b) a regenerativebrake operation mode (a short brake operation mode, i.e., a mode inwhich the stopping of the CR motor is maintained), or (c) a mode inwhich the CR motor is intended to be stopped.

Referring to FIGS. 3(a) and 3(b), the operation of the controller 80will be described below.

If a start-up command signal for starting the CR motor 4 is fed from theCPU 16 to the controller 80 of the DC unit 6 when the CR motor 4 isstopped, a start-up initial current value I_(o) is fed from theacceleration control part 91 to the D/A converter 96 via the selectionpart 95. Furthermore, this start-up initial current value I_(o),together with the start-up command signal, is fed from the CPU 16 to theacceleration control part 91. Then, this current value I_(o) isconverted into an analog current by the D/A converter 96 to be fed tothe driver 5, and the CR motor is started up by the driver 5 (see FIGS.3(a), 3(b)).

After the start-up command signal is received, the timer 90 generates atimer interruption signal for every predetermined time. Every time theacceleration control part 91 receives the timer interruption signal, theacceleration control part 91 integrates a predetermined current value(e.g., 20 mA) into the start-up initial current value I_(o), to feed theintegrated current value to the D/A converter 96 via the selection part95. Then, the integrated current value is converted into an analogcurrent by the D/A converter 96 to be fed to the driver 5. Then, the CRmotor is driven by the driver 5 so that the value of the currentsupplied to the CR motor 4 is the integrated current value, so that thespeed of the CR motor 4 increases (see FIG. 3(b)). Therefore, thecurrent value supplied to the CR motor is step-wise as shown in FIG.3(a).

Furthermore, at this time, although the PID control system alsooperates, the selection part 95 selects and incorporates the output ofthe acceleration control part 91.

The integration of the current value in the acceleration control part 91is carried out until the speed of the CR motor 4 reaches a speed V₀.When a current value integrated at time t₁ reaches the predeterminedvalue Iacc, the acceleration control part 91 halts the integrationoperation, and feeds the constant current value Iacc to the D/Aconverter 96 via the selection part 95 so that the driver 5 drives theCR motor 4 with the current value Iacc applied thereto (see FIG. 3(a)).During this process, the acceleration control part 91 sends a commandsignal to the inertia calculating part 93. After receiving the commandsignal, the memory 93 a stores the second period T₂ and the K-th periodT_(K) (K≧3) fed from the period measuring part 84. The timer 93 bmeasures a period of time T_(t) from the reception of the second periodT₂ to the K-th period T_(X).

Then, in order to prevent the speed of the CR motor 4 from overshooting,the acceleration control part 91 controls the CR motor 4 so as to reducethe current, which is supplied to the CR motor 4, when the speed of theCR motor 4 becomes a predetermined speed V₁ (see time t₂). At this time,the speed of the CR motor 4 further increases. However, when the speedof the CR motor 4 reaches a predetermined speed V_(c) (see time t, inFIG. 3(b)), the selection part 95 selects the output of the PID controlsystem, i.e., the output of the adder 89, to carry out the PID control.

That is, the target speed is calculated on the basis of the positiondeviation of the actual position, which is obtained from the output ofthe encoder 11, from the target position. In addition, the proportionalelement 87 a, integrating element 87 b and differentiating element 87 care operated on the basis of the speed deviation of the actual speed,which is obtained from the output of the encoder 11, from the targetspeed to carry out the proportional, integrating and differentiatingoperations. Moreover, the CR motor 4 is controlled on the basis of thesum of these calculated results. Furthermore, the above describedproportional, integrating and differentiating operations are carried outin synchronism with, e.g., the leading edge of the output pulse ENC-A ofthe encoder 11. Thus, the speed of the DC motor 4 is controlled so as tobe a desired speed V_(s). Furthermore, the predetermined speed V_(c) ispreferably a value of 70% to 80% of the desired speed V_(s).

Since the speed of the DC motor 4 is the desired speed V_(s) after timet₄, a printing processing can be carried out. When the printingprocessing is completed and when the carriage 3 reaches the targetposition (see time t, in FIG. 3(b)), deceleration control is performedby PID control system. Moreover, the output I_(f) of the integrationelement 87 b just before the deceleration control is fed to the inertiacalculating part 93 for calculation of the inertia J of the carriage 3having the rotary section of the CR motor 4.

When a target speed calculated by the target speed calculating part 83reaches the predetermined value V_(s) or less by the decelerationcontrol, the target speed calculating part 83 continuously outputs thepredetermined value V_(s).

When the deviation of an actual speed from the predetermined value V_(s)reaches a predetermined value or less (see time t₆), the stoppagecurrent calculating part 94 calculates the current value I_(STOP) to beapplied to the CR motor 4 according to the equation (2) for stopping thecarriage at the target position. The current value I_(STOP) is fed tothe D/A converter 96 via the selection part 95 so that the driver 5drives the CR motor 4 with the current value I_(STOP) to stop the CRmotor 4, or the carriage 3 at the target position (see time t₇ in FIG.3(b)).

As disclosed above, this embodiment achieves a rapid and precisestoppage of the carriage 3 at the target position.

The embodiment employs the carriage driven by the DC motor as an objectto be controlled. The present invention can, however, be applied topaper feeding.

One inertia calculation is usually executed for each one pass (one mainscanning operation during printing process). However, this is not amust, and it is preferable that an inertia calculation is executed basedon data necessary for the calculation, which have been stored at timing,such as, just before stoppage that will not affect encoder periods.

The calculated inertia is used not only for stoppage control but alsofor judging the status of the printing drive section to control thedrive section in a desired status. Moreover, inertia can be updated atany timing, such as, per page, after cleaning, and so on. Inertiacalculation may be conducted, however, inertia that is updated for thefirst time after same change has occurred in the former inertia can beused.

(Second Preferred Embodiment)

The second preferred embodiment will be disclosed with reference to FIG.9. The second embodiment is a method of controlling a motor for use in aprinter. A control procedure is shown in FIG. 9.

Firstly, inertial of the carriage 3 is calculated based on angularacceleration of the CR motor 4 under carriage acceleration control, andcurrent values applied to the CR motor 4 under carriage acceleration andconstant speed control (see step F1 in FIG. 9).

Calculated next is a stoppage current for stopping the carriage 3 at thetarget position based on the calculated inertia, an angular velocity ofthe CR motor 4 at carriage deceleration, a current value applied to theCR motor 4 under carriage constant control, and the stoppage constantT_(BRK), (see step F2 in FIG. 9).

The calculated stoppage current is then applied to the CR motor 4 forcarriage stoppage (see step F3 in FIG. 9).

The steps F2 and F3 in FIG. 9 are the steps for controlling a currentapplied to the CR motor 4 with the calculated inertia.

As disclosed above, according to the second embodiment, a stoppagecurrent is calculated according to inertia of the carriage 3 and the CRmotor 4 is controlled based on the calculated stoppage current, thusachieving rapid and precise carriage stoppage at the target position.

(Third Preferred Embodiment)

Referring to FIGS. 10 and 11, the third preferred embodiment of thepresent invention will be described below. This preferred embodimentrelates to a storage medium, in which a control program for controllinga motor for use in a printer has been stored. FIGS. 10 and 11 are aperspective view and block diagram showing an example of a computersystem 130 which uses a storage medium, in which a print control programin this preferred embodiment has been recorded.

In FIG. 10, the computer system 130 comprises a computer body 130including a CPU, a display unit 132, such as a CRT, an input unit 133,such as a keyboard or mouse, and a printer 134 for carrying out a print.

As shown in FIG. 11, the computer body 131 comprises an internal memory135 of a RAM, and a built-in or exterior memory unit 136. As the memoryunit 136, a flexible or floppy disk (FD) drive 137, a CD-ROM drive 138and a hard disk drive (HD) unit 139 are mounted. As shown in FIG. 10, aflexible disk or floppy disk (FD) 141 which is inserted into a slot ofthe FD drive 137 to be used, a CD-ROM 142 which is used for the CD-ROMdrive 138, or the like is used as a storage medium 140 for use in thememory unit 136.

As shown in FIGS. 10 and 11, it is considered that the FD 141 or theCD-ROM 142 is used as the storage medium for use in a typical computersystem. However, since this preferred embodiment relates to a controlprogram for controlling a motor for use in the printer 134, the controlprogram of the present invention may be recorded in, e.g., a ROM chip143 serving as a nonvolatile memory which is built in the printer 134.Of course, the storage medium may be any one of FDs, CD-ROMs, MOs(Magneto-Optical) disks, DVDs (Digital Versatile Disks), other opticalrecording disks, card memories, and magnetic tapes.

The storage medium 140 in this preferred embodiment is designed to storea control program of a control procedure including steps F1 through F3shown in FIG. 9. That is, the storage medium 140 in this preferredembodiment may store storing control program code for controlling amotor for use in a printer, including: a first program code forcalculating inertia of a carriage based on angular acceleration of acarriage motor under acceleration control of the carriage and currentvalues to be applied to the carriage motor under the accelerationcontrol and constant speed control of the carriage; a second programcode for calculating a stoppage current to be used for stopping thecarriage at a target position based on the calculated inertia, anangular velocity of the motor under deceleration control of thecarriage, the current value to be applied to the motor under theconstant speed control of the carriage, and a stoppage constant T_(BRK);and a third program code for stopping the carriage by applying thecalculated stoppage current to the motor.

As disclosed above, the present invention achieves rapid and precisestoppage of an object to be controlled.

While the present invention has been disclosed in terms of the preferredembodiment in order to facilitate better understanding thereof, itshould be appreciated that the invention can be embodied in various wayswithout departing from the principle of the invention. Therefore, theinvention should be understood to include all possible embodiments andmodification to the shown embodiments which can be embodied withoutdeparting from the principle of the invention as set forth in theappended claims.

1. A control unit for controlling a motor for use in a printer,comprising: a speed control part to control an object to be controlledthat is driven by the motor by acceleration control, constant speedcontrol, deceleration control, and stoppage control by controlling acurrent to be applied to the motor; an inertia calculating part tocalculate inertia of the object based on angular acceleration of themotor under the acceleration control of the object, and current valuesto be applied to the motor under the acceleration control and theconstant speed control of the object, the calculated inertia being usedby the speed control part for controlling the current to be applied tothe motor; and, a stoppage current calculating part to calculate astoppage current to be used for stopping the object at a target positionbased on the calculated inertia, an angular velocity of the motor underthe deceleration control of the object, the current value of the motorunder the constant speed control of the object, and a stoppage constantT_(BRK), the speed control part performing control of stopping theobject by applying the calculated stoppage current, wherein apredetermined current value Iacc is applied to the motor in a constantcurrent acceleration range under the acceleration control foraccelerating the object, the inertia calculation part calculatingangular acceleration Δω/Δt in the constant current acceleration range,and calculating inertia J of the object based on the angularacceleration Δω/Δt, a current value I_(f) to be applied to the motorunder the constant speed control of the object, and the current valueIacc.
 2. A computer-readable storage medium storing control program codefor controlling a motor for use in a printer, comprising: first programcode means for calculating inertia of a carriage based on angularacceleration of a carriage motor under acceleration control of thecarriage and current values to be applied to the carriage motor underthe acceleration control and constant speed control of the carriage;second program code means for calculating a stoppage current to be usedfor stopping the carriage at a target position based on the calculatedinertia, an angular velocity of the motor under deceleration control ofthe carriage, the current value to be applied to the motor under theconstant speed control of the carriage, and a stoppage constant T_(BRK);and third program code means for stopping the carriage by applying thecalculated stoppage current to the motor.
 3. A control unit forcontrolling a carriage motor for use in a printer, comprising: a speedcontrol part to control a carriage to be controlled that is driven bythe motor by acceleration control, constant speed control, decelerationcontrol, and stoppage control by controlling a current to be applied tothe motor; an inertia calculating part to calculate inertia of thecarriage based on angular acceleration of the motor under theacceleration control of the carriage, and current values to be appliedto the motor under the acceleration control and the constant speedcontrol of the carriage, the calculated inertia being used by the speedcontrol part for controlling the current to be applied to the motor; anda stoppage current calculating part to calculate a stoppage current tobe used for stopping the carriage at a target position based on thecalculated inertia, an angular velocity of the motor under thedeceleration control of the carriage, the current value of the motorunder the constant speed control of the carriage, and a stoppageconstant T_(BRK), the speed control part performing control of stoppingthe carriage by applying the calculated stoppage current.
 4. A controlunit for controlling a carriage motor for use in a printer, as set forthin claim 3 wherein a predetermined current value Iacc is applied to themotor in a constant current acceleration range under the accelerationcontrol for accelerating the carriage, the inertia calculation partcalculating angular acceleration Δω/Δt in the constant currentacceleration range, and calculating inertia J of the carriage based onthe angular acceleration Δω/Δt, a current value I_(f) to be applied tothe motor under the constant speed control of the carriage, and thecurrent value Iacc.
 5. A method of controlling a carriage motor for usein a printer, comprising: calculating inertia of a carriage to be drivenby the motor based on angular acceleration of the motor underacceleration control of the carriage and current values to be applied tothe motor under the acceleration control and a constant speed control ofthe carriage; and controlling a current to be applied to the motor bymeans of the calculated inertia, wherein the controlling of the currentcomprises: calculating a stoppage current to be used for stopping thecarriage at a target position based on the calculated inertia, anangular velocity of the motor under deceleration control of thecarriage, the current value of the motor under the constant speedcontrol of the carriage, and a stoppage constant T_(BRK); and stoppingthe carriage by applying the calculated stoppage current to the motor.6. A method of controlling a carriage motor for use in a printer, as setforth in claim 5, wherein the printer is a serial printer.
 7. A controlunit for controlling a motor for use in a printer, comprising: a speedcontrol part to control an object to be controlled that is driven by themotor by acceleration control, constant speed control, decelerationcontrol, and stoppage control by controlling a current to be applied tothe motor; and an inertia calculating part to calculate inertia of theobject based on angular acceleration of the motor under the decelerationcontrol of the object, and current values to be applied to the motorunder the deceleration control and the constant speed control of theobject, during the deceleration control after a printing processing iscompleted, the calculated inertia being used by the speed control partfor controlling the current to be applied to the motor.
 8. A controlunit for controlling a motor for use in a printer, as set forth in claim7, further comprising a stoppage current calculating part to calculate astoppage current to be used for stopping the object at a target positionbased on the calculated inertia, an angular velocity of the motor underthe deceleration control of the object, the current value of the motorunder the constant speed control of the object, and a stoppage constantT_(BRK), the speed control part performing control of stopping theobject by applying the calculated stoppage current.
 9. A control unitfor controlling a motor for use in a printer, as set forth in claim 8,wherein a predetermined current value Iacc is applied to the motor in aconstant current acceleration range under the acceleration control foraccelerating the object, the inertia calculation part calculatingangular acceleration Δω/Δt in the constant current acceleration range,and calculating inertia J of the object based on the angularacceleration Δω/Δt, a current value I_(f) to be applied to the motorunder the constant speed control of the object, and the current valueIacc.
 10. A control unit for controlling a motor for use in a printer,as set forth in claim 9, wherein the current value I_(f) corresponds toa speed of the object under constant speed control just before atransition from the constant speed control to the deceleration control.11. A control unit for controlling a motor for use in a printer, as setforth in claim 8, wherein the stoppage current calculating part uses anangular velocity under deceleration control just before a transitionfrom the deceleration control to the stoppage control, as the angularvelocity of the motor.
 12. A control unit for controlling a motor foruse in a printer, as set forth in claim 8, wherein the stoppage constantT_(BRK) is decided based on the current value to be applied to the motorunder the constant speed control and a positional deviation of an actualposition of the motor from the target position.
 13. A control unit forcontrolling a motor for use in a printer, as set forth in claim 7,further comprising a period measuring part to measure a period of eachoutput pulse of an encoder that rotates in accordance with rotation ofthe motor, the angular acceleration and the angular velocity of themotor being calculated based on the output of the period measuring part.14. A control unit for controlling a motor for use in a printer, as setforth in claim 7, wherein the motor is a carriage motor for driving acarriage.
 15. A method of controlling a motor for use in a printer,comprising: calculating inertia of an object to be driven by the motorbased on angular acceleration of the motor under deceleration control ofthe object, and current values to be applied to the motor underacceleration control and a constant speed control of the object, duringthe deceleration control after a printing processing is completed; andcontrolling a current to be applied to the motor by means of thecalculated inertia.
 16. A method of controlling a motor for use in aprinter, as set forth in claim 15, wherein the controlling of thecurrent includes: calculating a stoppage current to be used for stoppingthe object at a target position based on the calculated inertia, anangular velocity of the motor under the deceleration control of theobject, the current value of the motor under the constant speed controlof the object, and a stoppage constant T_(BRK); and stopping the objectby applying the calculated stoppage current to the motor.
 17. A methodof controlling a motor for use in a printer, as set forth in claim 15,wherein the object is a carriage of a serial printer.
 18. A computerreadable storage medium storing control program code for controlling amotor for use in a printer, comprising: first program code means forcalculating inertia of a carriage based on angular acceleration of acarriage motor under deceleration control of the carriage and currentvalues to be applied to the carriage motor under acceleration controland constant speed control of the carriage, during the decelerationcontrol after a printing processing is completed; second program codemeans for calculating a stoppage current to be used for stopping thecarriage at a target position based on the calculated inertia, anangular velocity of the motor under deceleration control of thecarriage, the current value to be applied to the motor under theconstant speed control of the carriage, and a stoppage constant T_(BRK);and third program code means for stopping the carriage by applying thecalculated stoppage current to the motor.